<?php

/**
 * LinkEmployeeLeave form base class.
 *
 * @method LinkEmployeeLeave getObject() Returns the current form's model object
 *
 * @package    Amawal Invest
 * @subpackage form
 * @author     Ameen Shoman<amin.shoman@gmail.com>
 */
abstract class BaseLinkEmployeeLeaveForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'employee_id'                   => new sfWidgetFormInputHidden(),
      'leave_type_id'                 => new sfWidgetFormInputHidden(),
      'month'                         => new sfWidgetFormInputHidden(),
      'year'                          => new sfWidgetFormInputHidden(),
      'leave_period'                  => new sfWidgetFormInputText(),
      'leaves_period_all'             => new sfWidgetFormInputText(),
      'all_emp_leaves_all_period'     => new sfWidgetFormInputText(),
      'all_emp_leaves_period'         => new sfWidgetFormInputText(),
      'section_emp_leaves_all_period' => new sfWidgetFormInputText(),
      'section_emp_leaves_period'     => new sfWidgetFormInputText(),
      'dept_emp_leaves_all_period'    => new sfWidgetFormInputText(),
      'dept_emp_leaves_period'        => new sfWidgetFormInputText(),
      'leave_percentage'              => new sfWidgetFormInputText(),
      'leaves_percentage_all'         => new sfWidgetFormInputText(),
      'section_percentage'            => new sfWidgetFormInputText(),
      'section_percentage_all'        => new sfWidgetFormInputText(),
      'dept_percentage'               => new sfWidgetFormInputText(),
      'dept_percentage_all'           => new sfWidgetFormInputText(),
      'branch_id'                     => new sfWidgetFormPropelChoice(array('model' => 'Branch', 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'employee_id'                   => new sfValidatorPropelChoice(array('model' => 'Employee', 'column' => 'id', 'required' => false)),
      'leave_type_id'                 => new sfValidatorPropelChoice(array('model' => 'CodeLeaveType', 'column' => 'id', 'required' => false)),
      'month'                         => new sfValidatorPropelChoice(array('model' => 'LinkEmployeeLeave', 'column' => 'month', 'required' => false)),
      'year'                          => new sfValidatorPropelChoice(array('model' => 'LinkEmployeeLeave', 'column' => 'year', 'required' => false)),
      'leave_period'                  => new sfValidatorNumber(array('required' => false)),
      'leaves_period_all'             => new sfValidatorNumber(array('required' => false)),
      'all_emp_leaves_all_period'     => new sfValidatorNumber(array('required' => false)),
      'all_emp_leaves_period'         => new sfValidatorNumber(array('required' => false)),
      'section_emp_leaves_all_period' => new sfValidatorNumber(array('required' => false)),
      'section_emp_leaves_period'     => new sfValidatorNumber(array('required' => false)),
      'dept_emp_leaves_all_period'    => new sfValidatorNumber(array('required' => false)),
      'dept_emp_leaves_period'        => new sfValidatorNumber(array('required' => false)),
      'leave_percentage'              => new sfValidatorNumber(array('required' => false)),
      'leaves_percentage_all'         => new sfValidatorNumber(array('required' => false)),
      'section_percentage'            => new sfValidatorNumber(array('required' => false)),
      'section_percentage_all'        => new sfValidatorNumber(array('required' => false)),
      'dept_percentage'               => new sfValidatorNumber(array('required' => false)),
      'dept_percentage_all'           => new sfValidatorNumber(array('required' => false)),
      'branch_id'                     => new sfValidatorPropelChoice(array('model' => 'Branch', 'column' => 'id', 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('link_employee_leave[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'LinkEmployeeLeave';
  }


}
